=begin rdoc
Definition File for 1129-reduced-initset.evl eventset

Author::    Matthias Woehrle  (mailto:matthias.woehrle@tik.ee.ethz.ch)
Copyright:: Copyright (c) 2008 ETH Zurich
License::   

TODO:

MISSING:

=end
$: << File.expand_path(File.dirname(__FILE__) + "/../lib")
path =  File.expand_path("~/Documents/ETH/tecdoc/woehrlem/paper/woehrlem2008_sensys_poster/trunk/src/tossim/")
require "rupeas"

Rupeas.new do

Type :senddone do
 with :name =>:seqNo, :fieldtype=> :periodic, :range => 0..255, :notification => :error
 with :name =>:origin, :fieldtype => :integer, :range => 0..100,:notification => :error
 with :name =>:destination, :fieldtype => :integer, :range => 0..100, :notification => :warning
 with :name =>:nodeid,:fieldtype=> :integer, :range => 0..100,:notification => :error
 with :name =>:time, :fieldtype => :float, :notification => :warning 
end
#[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,0,43,44,45,46,100,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79]

Type :receive do
 with :name =>:seqNo, :fieldtype=> :periodic, :range => 0..255, :notification => :error
 with :name =>:origin, :fieldtype => :integer, :range => 0..100,:notification => :error
 with :name =>:myaddress, :fieldtype => :integer, :range => 0..100, :notification => :warning
 with :name =>:nodeid,:fieldtype=> :integer, :range => 0..100,:notification => :error
 with :name =>:time, :fieldtype => :float, :notification => :warning 
end

all = loadlog(path + '/small.log')

p all

puts 'finished'

end
#
#routestart_temp = all.predicate(1){|send| send[:origin] == send[:nodeid] and send[:type] == :senddone}
#
#routestart = transform(routestart_temp, :merge, 1) do |e1|
#     {
#       :type => :transmission,
#       :nodeid => e1[:nodeid],
#       :seqNo => e1[:seqNo],
#       :origin => e1[:origin]
#     }
#     end
#
#
#resultset = routestart.iterative do |iteration|
#   temp = iteration.predicate(2) {|e1, e2| e1[:origin] == e2[:origin] and  e1[:origin] == e2[:origin] and ((e1[:type] == :transmission and \
#   e2[:type] == :receive and e1[:destination] == e2[:nodeid]) or (e1[:nodeid] == e2[:nodeid] and
#   e1[:type] == :transmission and e2[:type] == :send))
#   }
#   iteration.transform(temp, :merge, 2) do |e1, e2|
#   {
#     :nodeid => e2[:nodeid],
#     :type => :transmission,
#     :origin => e1[:origin],
#     :destination => e2[:destination],
#     :seqNo => e1[:seqNo]
#   }
#  end
#end